#include <bits/stdc++.h>

using namespace std;
int a[5], b[5], book[5], best = INT_MAX;

void dfs(int k) {
    if (k >= 5) {
        if (a[0] * a[3]) {
            best = min(best, (a[0] * 100 + a[1] * 10 + a[2]) * (a[3] * 10 + a[4]));
        }
        return;
    }
    for (int i = 0; i < 5; i++) {
        if (book[i])continue;
        a[k] = b[i];
        book[i] = 1;
        dfs(k + 1);
        book[i] = 0;
    }
}

int main() {
    for (int i = 0; i < 5; i++)cin >> b[i];
    dfs(0);
    cout << best;
    return 0;
}
